<%@page import="com.reachol.objects.Users"%>
<%@page import="com.reachol.objects.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%

String userName = request.getParameter("userName");
Users users = new Users();
users.load("ASC", "id");
int userNameControlFlag = 1; 
while (users.next()) {
	User tmpObj = (User) users.getNext();
	String controlUserName = tmpObj.getUsername();
	if (userName.equals(controlUserName)) 
	{
		userNameControlFlag = 0; //veritabanında aynı kayıt varsa 0 döndürür
		break;
		
	} 
	else
		userNameControlFlag = 1;

}
if(userNameControlFlag==1)
	{
	    String userId=(String)session.getAttribute("userId");
		User record = new User();
		record.load(Long.parseLong(userId));
		record.setUsername(userName);
		record.setStep(2);
		record.store();
	}
	
%>
<%=userNameControlFlag%>